﻿@using CommonApp
@using System.Configuration
@{
    Response.Expires = 0;
    Response.Cache.SetNoStore();
    Response.AppendHeader("Pragma", "no-cache");
}
@helper PutUserName()
{
    if (User.Identity.IsAuthenticated)
    {
    @:Welcome to IBank, <a id="userName" href="/private">@User.Identity.Name</a>!
    }
    else
    {
    @:Welcome to IBank!
    }
}
@helper GetCurrencyRates(){
    var factory = new IBS.Bll.ServicesFactory();
    var currencyService = factory.GetInstance<IBS.ServiceContracts.ICurrencyService>();
    var rates = currencyService.GetCurrentRates("USD");
    
     @:<table>
        <tr>USD</tr>
        <tr>
            <td>Ask</td>
            <td>@rates.AskRate</td>
        </tr>
        <tr>
            <td>Bid</td>
            <td>@rates.BidRate</td>
        </tr>
    @:</table>
   
}
<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
   <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.tabs.css")" rel="stylesheet" type="text/css" />
    @RenderSection("css", false)
    <link href="../../Scripts/ext-3.1.0/resources/css/ext-all.css" rel="Stylesheet" type="text/css" />
     
    <script type="text/javascript" src="../../Scripts/ext-3.1.0/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="../../Scripts/ext-3.1.0/ext-all.js"></script>
    <script type="text/javascript" src="../../Scripts/ext-3.1.0/XmlTreeLoader.js"></script>
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    @RenderSection("script", false)
    <script src="@Url.Content("~/Scripts/jquery.noty.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/top.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/default.js")" type="text/javascript"></script>
    @if (ViewBag.EnsureSecurity != null && (bool)ViewBag.EnsureSecurity)
    {
        <script src="@Url.Content("~/Scripts/securityCodeRequest.js")" type="text/javascript"></script>
    }
    <script type="text/javascript">
        $(function() {
            @{
                foreach (dynamic notification in this.Notifications())
            {
                @:noty({ text: "@notification.message", type: "@notification.type" });
            }
        }
        });
        var sessionTimeout = @Session.Timeout;
    </script>
    @if (ViewBag.DoNotNotifyAboutTimeout == null)
    {
        <script src="@Url.Content("~/Scripts/userSession.js")" type="text/javascript"></script>
    }
</head>
<body>
    <div class="page">
        <div id="header">
            <div class="logoContainer">
                <a href="/Home/Index">
                    <img src="../../Content/images/ibanklogo.png" />
                </a>
            </div>

            <div id="title">
                @if (User.Identity.IsAuthenticated)
                {
                    <div id="logout">
                        <a href="/Admission/LogOff">
                            <img src="@Url.Content("~/Content/images/log_out.png")" />
                        </a>
                    </div>
                }
                
                <div style="padding-left: 200px;">
                    @GetCurrencyRates()
                </div>
                
                <div>
                    <h1>@PutUserName()</h1>
                </div>
            </div>
        </div>
        <div id="main">
            @RenderBody()
        </div>
        <div id="footer">
        </div>
    </div>

    @{
        if (ViewBag.EnsureSecurity != null && (bool)ViewBag.EnsureSecurity)
        {
        <div id="securityCodeRequest" title="Security Code Check">
            <p>
                Please, enter code #@Html.Action("AskSecurityCode", "Security"):
            </p>
            <input id="codeValue" type="text" />
        </div>
        }
    }
</body>
</html>
